package cn.xluobo.business.wechat.miniapp.course.controller;

import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseCla;
import cn.xluobo.business.sc.course.domain.resp.cla.RespClaAllDetailInfo;
import cn.xluobo.business.sc.course.service.BusinessScCourseClaService;
import cn.xluobo.business.wechat.miniapp.course.service.WechatMiniClaService;
import cn.xluobo.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 班级
 * @author ：KingLong
 * @date ：Created in 2020/11/2 06:24
 */
@RestController
@RequestMapping("/api/wechat/miniapp/{appId}/cla")
public class WechatMiniClaController {

    @Autowired
    private WechatMiniClaService wechatMiniClaService;
    @Autowired
    private BusinessScCourseClaService businessScCourseClaService;

    /**
     * 班级列表
     * @return
     */
    @GetMapping("/searchList")
    public APIResponse searchList(ReqSearchScCourseCla reqSearchScCourseCla) {
        return wechatMiniClaService.searchList(reqSearchScCourseCla);
    }

    /**
     * 详情
     *
     * @param claId
     * @return
     */
    @GetMapping("/allDetailInfoById/{claId}")
    public APIResponse allDetailInfoById(@PathVariable("claId") Long claId) {
        RespClaAllDetailInfo allDetailInfo = businessScCourseClaService.allDetailInfoById(claId);
        return APIResponse.toAPIResponse(allDetailInfo);
    }

}
